<?php
namespace Admin\Controller;
use Admin\Controller\CommonController;
class InternetController extends CommonController {

	public function index() {
		$M=M("ziliao");
		$count = $M->count();
	
		$this->assign("page", $showPage);
		$this->assign("pageCount",$count);
		$this->assign("list", $M->limit($page->firstRow, $page->listRows)->select());
		$this->display();
	}
	
	
		
	/**
	 +----------------------------------------------------------
	 * 添加管理员
	 +----------------------------------------------------------
	 */
	public function addAdmin() {
		    $zi=M('ziliao');
		    $info=$zi->where('id=1')->find();
            $this->assign('info',$info);
        
		if (IS_POST) {
			$data=array();
			$data=I('post.');
			header('Content-Type:application/json; charset=utf-8');
			if(M('ziliao')->save($data)){
				$this->success('更新成功',U('Internet/index'));
			}else{
				$this->error(M('ziliao')->getError());
			}

		} 
		$this->display();
	}
	

	/**
	 +----------------------------------------------------------
	 * 更新信息
	 +----------------------------------------------------------
	 */
	public function edit(){
		if(IS_POST){
			$data=array();
			$data=I('post.');
			$zi=M('ziliao')->where('id=1')->save($data);
			if($zi){
				$this->redirect('Internet/index');

			}else{
				$this->success('信息未更新',U('Internet/index'));
			}
		}
	}



    		
}

    
  


?>